import 'package:json_annotation/json_annotation.dart';

part 'goods_model.g.dart';

@JsonSerializable()
class GoodsModel extends Object {
  @JsonKey(name: 'sign')
  String sign;

  @JsonKey(name: 'list')
  List<Goods> list;

  GoodsModel(
    this.sign,
    this.list,
  );

  factory GoodsModel.fromJson(Map<String, dynamic> srcJson) =>
      _$GoodsModelFromJson(srcJson);

  Map<String, dynamic> toJson() => _$GoodsModelToJson(this);
}

@JsonSerializable()
class Goods extends Object {
  @JsonKey(name: 'id')
  int id;

  @JsonKey(name: 'title')
  String title;

  @JsonKey(name: 'custom_id')
  String customId;

  @JsonKey(name: 'price')
  int price;

  @JsonKey(name: 'price_desc')
  String priceDesc;

  @JsonKey(name: 'coin')
  String coin;

  @JsonKey(name: 'coin_desc')
  String coinDesc;

  @JsonKey(name: 'status')
  int status;

  @JsonKey(name: 'created_at')
  int createdAt;

  @JsonKey(name: 'updated_at')
  int updatedAt;

  @JsonKey(name: 'type')
  String type;

  @JsonKey(name: 'time_type')
  String timeType;

  @JsonKey(name: 'order_no')
  int orderNo;

  @JsonKey(name: 'app_id')
  int appId;

  @JsonKey(name: 'tags_desc')
  String tagsDesc;

  Goods(
    this.id,
    this.title,
    this.customId,
    this.price,
    this.priceDesc,
    this.coin,
    this.coinDesc,
    this.status,
    this.createdAt,
    this.updatedAt,
    this.type,
    this.timeType,
    this.orderNo,
    this.appId,
    this.tagsDesc,
  );

  factory Goods.fromJson(Map<String, dynamic> srcJson) =>
      _$GoodsFromJson(srcJson);

  Map<String, dynamic> toJson() => _$GoodsToJson(this);
}
